-- CALC_CAVE_17_TARGET_CLASS

-- 计算埋骨地的中心格子类型
return function()
    local skeleton = { ["class"] = 92, ["ratio"] = 60 }; -- 骸骨堆
    local head     = { ["class"] = 93, ["ratio"] = 40 }; -- 头骨祭坛
    local wreckage = { ["class"] = 94, ["ratio"] = 15 }; -- 巨大的残骸

    local arr = { skeleton, head, wreckage};

    -- 巨大的残骸只出现一次
    if DungeonInstanceM.getInstanceStat(wreckage["class"]) > 0 then
        wreckage["ratio"] = 0;
    end

    -- 迷宫小关不出现
    local dungeonId = DungeonM.getDungeonId();
    if type(dungeonId) == "number" and dungeonId > 0 and
        DungeonAreaM.query(dungeonId, "type") == "child" then
        wreckage["ratio"] = 0;
    end

    -- 先过滤一遍
    DungeonInstanceM.filterInstanceGrids(arr);

    local seed = DungeonM.getRandSeed("CALC_CAVE_17_TARGET_CLASS");
    local info = fetchElemBySeed(arr, seed);

    return info["class"];
end
